Skip to content

render JSON object keys correctly - #632

Merged
bgentry merged 1 commit into
masterfrom
bg/fix-json-view-keys
Aug 1, 2026
Merged

render JSON object keys correctly#632
bgentry merged 1 commit into
masterfrom
bg/fix-json-view-keys

Conversation

@bgentry

@bgentry bgentry commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

JSONView currently treats property-key presence as a truthy check, so an empty-string key is rendered as though its value were at the root. Keys are also interpolated between quote characters without JSON escaping, which makes quotes and control characters display incorrectly.

This checks the existing null sentinel explicitly and renders keys with JSON.stringify, keeping empty and escaped property names visible as valid JSON strings.

Stacked on #594; the reviewable change is the single commit above that branch.

@bgentry
bgentry force-pushed the bg/fix-json-view-keys branch from 2cabaaf to cb2b792 Compare August 1, 2026 00:48
@bgentry
bgentry marked this pull request as ready for review August 1, 2026 03:21
Base automatically changed from bg/fix-job-args-precision to master August 1, 2026 15:09
`JSONView` uses property-key truthiness to distinguish root values from
object properties, which drops empty-string keys from rendered output. It
also interpolates keys between quotes without escaping their contents.

Check the existing null sentinel explicitly and render property keys with
`JSON.stringify`. This keeps empty and escaped keys visible as valid JSON
strings in the structured viewer.

Cover both cases in the component tests.
@bgentry
bgentry force-pushed the bg/fix-json-view-keys branch from cb2b792 to a7ea4d7 Compare August 1, 2026 15:09
@bgentry
bgentry merged commit e68e5b1 into master Aug 1, 2026
21 checks passed
@bgentry
bgentry deleted the bg/fix-json-view-keys branch August 1, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants